package com.ha.springcloud.service;


import com.ha.springcloud.mapper.EmployeeMapper;
import com.ha.springcloud.pojo.Employee;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmployeeServiceImpl implements EmployeeService{

    @Autowired
    private EmployeeMapper employeeMapper;

    @Override
    public List<Employee> queryEmployeeList() {
        return employeeMapper.queryEmployeeList();
    }

    @Override
    public Employee queryEmployeeById(String id) {
        return employeeMapper.queryEmployeeById(id);
    }

    @Override
    public int addEmployee(Employee employee) {
        return employeeMapper.addEmployee(employee);
    }

    @Override
    public int updateEmployee(Employee employee) {
        return employeeMapper.updateEmployee(employee);
    }

    @Override
    public int deleteEmployee(String id) {
        return employeeMapper.deleteEmployee(id);
    }

    @Override
    public int getMaxId() {
        String empId=employeeMapper.getMaxId();
        int id=Integer.parseInt(empId);
        id++;
        return id;
    }


}
